#include "stdafx.h"
#include "./timeutils.h"

namespace{
	TimeUtils g_timeutils;
}

time_type TimeUtils::s_frequency;
float TimeUtils::s_differMultNum = 1;

TimeUtils::TimeUtils()
{
	::QueryPerformanceFrequency(&s_frequency);
}

void TimeUtils::SetDifferMultNum(float multnum)
{
	s_differMultNum = multnum;
}

time_type TimeUtils::GetTime()
{
	static LARGE_INTEGER time;
	::QueryPerformanceCounter(&time);
	return time;
}

float TimeUtils::GetTimeDiffer(time_type t1, time_type t2)
{
	return (float)(t1.QuadPart - t2.QuadPart) / (s_differMultNum * (float)s_frequency.QuadPart); //s
}